package com.nt.thah.enums;

/**
 * @Description: 订单状态
 * @Author: ls
 * @Date: 2020/08/21 10:04
 */
public enum LevelEnum {

    ZC(1, "低碳新手"),
    FX(2, "低碳先锋"),
    QD(3, "低碳高手"),
    BX(4, "低碳达人"),
    DT(5, "低碳超人"),
    ;
    private Integer level;

    private String name;

    public Integer getStatus() {
        return level;
    }

    public String getName() {
        return name;
    }

    public static Integer getLevel(String name) {
        for (LevelEnum item : LevelEnum.values()) {
            if (item.name.equals(name)) {
                return item.level;
            }
        }
        return null;
    }

    public static String getName(Integer level) {
        LevelEnum[] enums = values();
        for (LevelEnum ele : enums) {
            if (ele.level.equals(level)) {
                return ele.name;
            }
        }
        return null;
    }

    LevelEnum(Integer level, String name) {
        this.level = level;
        this.name = name;
    }

    public static void main(String[] args) {
        System.out.println(getName(1));
    }
}